package org.wenhua.yuan.and.fragment

import android.os.Bundle
import io.flutter.embedding.android.FlutterFragment

import org.wenhua.yuan.R
import org.wenhua.yuan.and.module_flutter.flutterM2.FlutterUtil

class DOUTabFragment : IBaseFragment() {
    private var myFlutterFragment: FlutterFragment? = null
    override fun getLayoutRes(): Int {
        return R.layout.fragment_dou_tab
    }


    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        showFlutterModule()

    }

    private fun showFlutterModule() {
        myFlutterFragment = FlutterUtil.createFragment(activity!!, "fragment_dou", "/fragment_dou")
        if (myFlutterFragment!!.isAdded) {
            activity!!.supportFragmentManager
                .beginTransaction().show(myFlutterFragment!!)
        } else {
            activity!!.supportFragmentManager
                .beginTransaction()
                .add(R.id.flutterDou, myFlutterFragment!!, "flutter:"+R.id.flutterDou)
                .commit()
        }
    }

}
